package org.bl.chat.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.bl.chat.common.dto.Response;
import org.bl.chat.model.dto.MessageDTO;
import org.bl.chat.model.po.UserDO;
import org.bl.chat.service.MessageService;
import org.bl.chat.service.UserService;
import org.bl.chat.util.IpUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Api("消息类")
@RestController
@RequestMapping("message")
public class MessageController {

    @Resource
    private MessageService messageService;

    @GetMapping("/getMessage")
    @ApiOperation("根据channelId查询对话记录")
    public Response<List<MessageDTO>> getMessage(String channelId, Integer page) {
        List<MessageDTO> messageDTOS = messageService.findByChannelId(channelId, page);
        return Response.ok(messageDTOS);
    }

}
